import { defineConfig } from 'vite';
import path, { resolve } from 'path';
import uni from '@dcloudio/vite-plugin-uni';
import AutoImport from 'unplugin-auto-import/vite';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        uni(),
        // 配置自动导入 vue相关函数, uni-app相关函数。ref, reactive，onLoad等
        AutoImport({
            // 自动导入
            imports: ['vue', 'uni-app'],
            dts: '.auto-import.d.ts', // 生成 `auto-import.d.ts` 全局声明
        }),
    ],
    resolve: {
        alias: {
            '@': resolve(__dirname, 'src'),
            '@a': resolve(__dirname, 'src/api'),
            '@u': resolve(__dirname, 'src/utils'),
        },
    },
});
